package com.example.demo.controller.AuthorControl;

import com.example.demo.entity.BackResponseEntity;
import com.example.demo.entity.requestJson.CodeLoginReq;
import com.example.demo.entity.requestJson.LoginReq;
import com.example.demo.entity.responseJson.LoginRes;
import com.example.demo.service.ALoginService;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * @author : 杨丽辉
 * @date : 2021/1/7 10:05
 * @description:
 */
@RestController
@RequestMapping("/author/dologin")
@Api(value = "作者授权接口", tags = "作者授权接口")

public class ALoginController {
    @Autowired
    private ALoginService aLoginService;

    @ApiOperation(value = "作者账号密码登录", notes = "")
    @ApiOperationSupport(author = "杨")
    @ApiResponses(
            @ApiResponse(code = 200, message = "处理成功")
    )
    @PostMapping("/login")
    public BackResponseEntity<LoginRes> doLogin(@RequestBody LoginReq loginReq) {
        return aLoginService.doLogin(loginReq);
    }

    @ApiOperation(value = "作者手机验证码登录", notes = "")
    @ApiOperationSupport(author = "杨")
    @ApiResponses(
            @ApiResponse(code = 200, message = "处理成功")
    )
    @PostMapping("/codelogin")
    public BackResponseEntity<LoginRes> codeLogin(@RequestBody CodeLoginReq codeLoginReq) {
        return aLoginService.codeLogin(codeLoginReq);
    }
}
